package com.yili.oa.dao;

import com.yili.oa.models.RewardHistory;
import com.yili.oa.models.RewardHistoryExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface RewardHistoryMapper {
    @SelectProvider(type=RewardHistorySqlProvider.class, method="countByExample")
    long countByExample(RewardHistoryExample example);

    @DeleteProvider(type=RewardHistorySqlProvider.class, method="deleteByExample")
    int deleteByExample(RewardHistoryExample example);

    @Delete({
        "delete from ft_reward_history",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into ft_reward_history (id, reward_time, ",
        "reward_sum, reward_money, ",
        "user_id)",
        "values (#{id,jdbcType=BIGINT}, #{rewardTime,jdbcType=TIMESTAMP}, ",
        "#{rewardSum,jdbcType=REAL}, #{rewardMoney,jdbcType=REAL}, ",
        "#{userId,jdbcType=BIGINT})"
    })
    int insert(RewardHistory record);

    @InsertProvider(type=RewardHistorySqlProvider.class, method="insertSelective")
    int insertSelective(RewardHistory record);

    @SelectProvider(type=RewardHistorySqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="reward_time", property="rewardTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="reward_sum", property="rewardSum", jdbcType=JdbcType.REAL),
        @Result(column="reward_money", property="rewardMoney", jdbcType=JdbcType.REAL),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT)
    })
    List<RewardHistory> selectByExample(RewardHistoryExample example);

    @Select({
        "select",
        "id, reward_time, reward_sum, reward_money, user_id",
        "from ft_reward_history",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="reward_time", property="rewardTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="reward_sum", property="rewardSum", jdbcType=JdbcType.REAL),
        @Result(column="reward_money", property="rewardMoney", jdbcType=JdbcType.REAL),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT)
    })
    RewardHistory selectByPrimaryKey(Long id);

    @UpdateProvider(type=RewardHistorySqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") RewardHistory record, @Param("example") RewardHistoryExample example);

    @UpdateProvider(type=RewardHistorySqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") RewardHistory record, @Param("example") RewardHistoryExample example);

    @UpdateProvider(type=RewardHistorySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(RewardHistory record);

    @Update({
        "update ft_reward_history",
        "set reward_time = #{rewardTime,jdbcType=TIMESTAMP},",
          "reward_sum = #{rewardSum,jdbcType=REAL},",
          "reward_money = #{rewardMoney,jdbcType=REAL},",
          "user_id = #{userId,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(RewardHistory record);
}